import pygame

from bg_color import *

class BloodBaar:
    def __init__(self, screen, screen_rect):
        self.screen = screen
        self.screen_rect = screen_rect

        self.bloodWid = 150

        pygame.font.init()
        


    def update(self, percen=1):
        self.percen = percen
        self.bText = pygame.font.SysFont("comicsans", 19, True).render('Blood', True, bg_red)
        self.bTxtRect = self.bText.get_rect()

        self.display()

    def display(self):
        self.bBar = pygame.draw.rect(self.screen, bg_color_blood_bar, pygame.Rect(self.screen_rect.width - self.bloodWid - 30,20, self.bloodWid + 2, 22), 1)
        self.blood = pygame.draw.rect(self.screen, bg_color_blood, pygame.Rect(self.screen_rect.width - self.bloodWid - 29, 21, self.bloodWid * self.percen ,20))

        # self.bText.get_rect()
        self.bTxtRect.center = self.bBar.center

        self.screen.blit(self.bText, self.bTxtRect)